﻿using System;

namespace RockHopper.Common.Model
{
    public class HeartRateZones
    {
        public int EasyLower { get; set; }
        public int EasyUpper { get; set; }
        public int MarathonLower { get; set; }
        public int MarathonUpper { get; set; }
        public int ThresholdLower { get; set; }
        public int ThresholdUpper { get; set; }
        public int IntervalLower { get; set; }
        public int IntervalUpper { get; set; }

        public static HeartRateZones Create(int resting, int maximum)
        {
            var workingRange = maximum - resting;
            var zones = new HeartRateZones
            {
                EasyLower = resting + (int)(0.65 * workingRange),
                EasyUpper = resting + (int)(0.79 * workingRange),
                MarathonLower = resting + (int)(0.8 * workingRange),
                MarathonUpper = resting + (int)(0.9 * workingRange),
                ThresholdLower = resting + (int)(0.88 * workingRange),
                ThresholdUpper = resting + (int)(0.92 * workingRange),
                IntervalLower = resting + (int)(0.98 * workingRange),
                IntervalUpper = maximum
            };
            return zones;
        }
    }
}
